/*
 * @Description: 用户相关接口
 * @Author: Yong
 * @Date: 2021-10-04 22:21:11
 * @LastEditTime: 2021-10-06 16:59:14
 */

import Axios from '@utils/axios'
import { HttpResponse, LoginParams, SearchParams } from './interface'

/**
 * @description User类型的接口方法
 * @interface loginParams -登录参数
 * @property {string} U_LoginID -用户名
 * @property {string} U_Password -用户密码
 */
export class UserService {
    /**
     * @description 登录接口
     * @return {HttpResponse} result
     */
    static async login (params: LoginParams): Promise<HttpResponse> {
        return Axios({
            method: 'post',
            url: '/user/login',
            data: params,
        })
    }

    /**
     * @description 用户注册
     * @param params 
     * @returns 
     */
    static async register (params: LoginParams): Promise<HttpResponse> {
        return Axios({
            method: 'post',
            url: '/user/register',
            params,
        })
    }

    /**
     * @description 搜素用户
     * @param params 
     * @returns 
     */
    static async searchUser (params: SearchParams): Promise<HttpResponse> {
        return Axios({
            method: 'post',
            url: '/user/searchUser',
            data: params,
        })
    }
}
